package tr.muyat.accelerometer.sender;

public class Utils {
	
	/**
	 * Writes floats to byte array
	 * 
	 * @param inData
	 * @return
	 */
	public static final byte[] float2Byte(float[] inData) {
		int j = 0;
		int length = inData.length;
		byte[] outData = new byte[length * 4];
		for (int i = 0; i < length; i++) {
			int data = Float.floatToIntBits(inData[i]);
			outData[j++] = (byte) (data >>> 24);
			outData[j++] = (byte) (data >>> 16);
			outData[j++] = (byte) (data >>> 8);
			outData[j++] = (byte) (data >>> 0);
		}
		return outData;
	}

}
